package application.controller;

import java.awt.event.*;

import javax.swing.*;

import application.model.*;
import application.main.*;

public class ButtonController extends AbstractController implements ActionListener
{
	private static final long serialVersionUID = 1L;
	private JButton btnStepOne;
	private JButton btnStepHundred;
	
	public ButtonController(Simulator model)
	{
		super(model);
		
		this.btnStepOne = new JButton("Step 1");
		this.btnStepHundred = new JButton("Step Hundred");
		
		this.btnStepOne.addActionListener(this);
		this.btnStepHundred.addActionListener(this);
		
		add(this.btnStepOne);
		add(this.btnStepHundred);
		
		setVisible(true);
	}

	@Override
	public void actionPerformed(ActionEvent e) 
	{		
		if(e.getSource().equals(this.btnStepOne))
		{
			model.simulateOneStep();
			System.out.println("Step 1 button clicked");
		}
		else if(e.getSource().equals(this.btnStepHundred))
		{
			model.simulate(100);
			System.out.println("Step Hundred button clicked");
		}
	}

}
